﻿using AppDemo.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace AppDemo.Views
{
    public sealed partial class Menu : UserControl
    {
        public MainViewModel ViewModel
        {
            get { return this.DataContext as MainViewModel != null ? this.DataContext as MainViewModel : new MainViewModel(); }
        }
        public Menu()
        {
            this.InitializeComponent();
        }

        private void btnSpeakers_Click(object sender, RoutedEventArgs e)
        {
            ViewModel.Current = MainViewModel.CurrentView.speakers;
            btnSpeakers.Opacity = 1;
            btnSessions.Opacity = 0.5;
            btnRecherche.Opacity = 0.5;
            btnInfos.Opacity = 0.5;
            GoToSpeakers.Begin();
        }

        private void btnSessions_Click(object sender, RoutedEventArgs e)
        {
            ViewModel.Current = MainViewModel.CurrentView.sessions;
            btnSessions.Opacity = 1;
            btnSpeakers.Opacity = 0.5;
            btnRecherche.Opacity = 0.5;
            btnInfos.Opacity = 0.5;
            GoToSessions.Begin();
        }

        private void btnInfos_Click(object sender, RoutedEventArgs e)
        {
            ViewModel.Current = MainViewModel.CurrentView.infos;
            btnInfos.Opacity = 1;
            btnSessions.Opacity = 0.5;
            btnRecherche.Opacity = 0.5;
            btnSpeakers.Opacity = 0.5;
            GoToInfos.Begin();
        }

        private void btnRecherche_Click(object sender, RoutedEventArgs e)
        {
            ViewModel.Current = MainViewModel.CurrentView.recherche;
            btnRecherche.Opacity = 1;
            btnSessions.Opacity = 0.5;
            btnSpeakers.Opacity = 0.5;
            btnInfos.Opacity = 0.5;
            GoToSearch.Begin();
        }
    }
}
